﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GestureMatching.DataStructure;

namespace GestureMatching
{
    public class GestureMapper
    {
        public static readonly String MEANING_PREVIOUS_SLIDE = "previous_slide";
        public static readonly String MEANING_NEXT_SLIDE = "next_slide";

        private LinkedList<Dictionary<String, Object>> allGestureRecord;

        public GestureMapper(LinkedList<Dictionary<String, Object>> allGestureRecord)
        {
            this.allGestureRecord = allGestureRecord;
        }

        public LinkedList<Dictionary<String, Object>> GetAllGestureRecord()
        {
            return allGestureRecord;
        }

        public void Mapping(TimingQueue gesture)
        {
            Matcher matcher = new Matcher(allGestureRecord);
            Dictionary<String, Object> gestureRecord = matcher.Matching(gesture);
            String gestureMeaning = (String)gestureRecord[GestureRecordManager.KEY_GESTURE_MEANING];

            if (gestureMeaning == MEANING_PREVIOUS_SLIDE)
            {
                //TODO:Achieve the code which go to previous slide;
                Console.WriteLine("You are send the previous_slide command successfully.");
            }
            else if (gestureMeaning == MEANING_NEXT_SLIDE)
            {
                //TODO:Achieve the code which go to next slide;
                Console.WriteLine("You are send the next_slide command successfully.");
            }
        }
    }
}
